      module exact
!     Formulates exact solution numerically
      use prec

      contains

      function exact_solution(x) result(y)
!     finds absolute difference between components of two vectors
      use prec
      implicit none
      real(dp) :: y
      real(dp), intent(in) :: x
      real(dp), parameter :: e = EXP(1.0_dp)
      real(dp), parameter :: c1 = -0.5_dp
      real(dp), parameter :: c2 = 1./(2.*sin(20.))*(cos(20.)-1./(e**20.)*(1.+20.)**2.)

!     Problem 1.
!      y=(x*x-1.)*sin(x)
!     Problem 2.
!      y = c1*cos(x)+c2*sin(x)+0.5*1./(e**x)*(1.+x)**2.
!     Problem 3.
      y=e**x
      end function

      end module
